#include <iostream>
#include <string>

using namespace std;

int main() {
    string a, b;
    cin >> a >> b;
    int n = a.size(), m = b.size();
    int ret = m;
    for (int i = 0; i <= m - n; i++){
        int tmp = 0;
        for (int j = 0; j < n; j++){
            if (b[i + j] != a[j]) tmp++;
        }
        ret = min(ret, tmp);
    }

    cout << ret << endl;
    return 0;
}